package com.itmayiedu.main;


import com.itmayiedu.main.threadpool.impl.MyConnectionPool;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.sql.Connection;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@SpringBootApplication
public class ApplicationJDBC {
    public static void main(String[] args) {
        SpringApplication.run(ApplicationJDBC.class,args);
//        MyConnectionPool myConnectionPool=new MyConnectionPool();
//        ExecutorService service = Executors.newFixedThreadPool(3);
//        for (int i=0;i<3;i++){
//            service.submit(()->{
//                for (int j = 0; j < 10; j++) {
//                    try {
//                        Connection connection =myConnectionPool.getConnection();
//                        System.out.println(Thread.currentThread().getName() + ",connection:" + connection);
//                        myConnectionPool.releaseConnection(connection);
//                    } catch (Exception e) {
//                        e.printStackTrace();
//                    }
//                }
//            });
//        }
    }
    }

